#ifndef CORE_NETWORK_H
#define CORE_NETWORK_H

class CNetConnection;
class CNetAcceptor;
class CNetClient;
class CNetConnector;
class CNetCaptor;

class CNetwork
{
public:
	CNetwork();

	~CNetwork();

	bool startup();

	bool isStarted() const
	{
		return m_started;
	}

	bool shutdown();

	void setWaitingTime(u32 _time);

	bool run();

	CNetAcceptor *createAcceptor(s32 _port);

	CNetConnector *createConnector();

	s32 getLastError() const;

	stringc getHostName() const;

private:

	enum
	{
		SELECT_MAX_CONNECTIONS = FD_SETSIZE
	};

	bool m_started;

	fd_set m_fdset;

	timeval m_select_time;

	CArray<CNetConnection*> m_conns;
};

#endif //CORE_NETWORK_H
